package com.ytzl.exceptions;

/**
 * 用户名已被注册
 */

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class UserCodeNotRegistException extends Throwable {

    @ExceptionHandler(value = RuntimeException.class)
    public String exceptionHandler(Exception e){
        System.out.println("用户名已被注册");
        return e.getMessage();
    }
}
